import {createApp} from 'vue'
import website from './config/website'
import defaultdata from './config/defaultdata'
import axios from './axios';
import router from './router/index';
import store from './store';

const app = createApp(App)

import {language, messages} from './lang/';
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import './styles/element/index.scss'
// import 'element-plus/dist/index.css'
import ElementPlus from 'element-plus'
import Avue from '@smallwei/avue';
import '@smallwei/avue/lib/index.css';
import {getScreen,setSearchByUrlParams} from './utils/util'
import crud from './utils/crud'
import dict from './utils/dict'
import './permission';
import i18n from './lang/';
import error from './error';
import basicBlock from 'components/basic-block/main.vue'
import basicContainer from 'components/basic-container/main.vue'
import App from './App.vue'
import 'animate.css'
import dayjs from 'dayjs'
import 'styles/common.scss';

window.axios = axios;

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    //加入下面的代码才能在avue的icon组件中显示
    app.component(`El${key}`, component)
}

app.component('basicContainer', basicContainer)
app.component('basicBlock', basicBlock)
app.config.globalProperties.$dayjs = dayjs
app.config.globalProperties.website = website
app.config.globalProperties.defaultdata = defaultdata
app.config.globalProperties.crud = crud
app.config.globalProperties.dict = dict
app.config.globalProperties.getScreen = getScreen
app.config.globalProperties.setSearchByUrlParams = setSearchByUrlParams
app.use(error);
app.use(i18n)
app.use(store)
app.use(router)
app.use(ElementPlus, {
    locale: messages[language]
})
app.use(Avue, {
    axios,
    locale: messages[language]
})

import {configureMdEditor} from './md-editor-config.js'

configureMdEditor(app)

import TinymceEditor from 'components/vue-tinymce/index.vue';

app.component('TinymceEditor', TinymceEditor);

app.mount('#app')




